home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / RIGHT.dxr / 00145.ls < prev    next >
Encoding:
Text File  |  1998-07-22  |  2.2 KB  |  51 lines

  1. on mouseDown me
  2.   set the cursor of sprite the spriteNum of me to [member "Closed Hand", member "Closed Hand Mask"]
  3.   repeat while the stillDown
  4.     if (the mouseV <= (the top of sprite 3 - 5)) and (the mouseV > 3) then
  5.       set the locV of sprite 8 to the mouseV
  6.       spriteBox(5, the left of sprite 5, the locV of sprite 8, the right of sprite 5, the bottom of sprite 5)
  7.       spriteBox(6, the left of sprite 6, the locV of sprite 8, the right of sprite 6, the bottom of sprite 6)
  8.       set the floatPrecision to 5
  9.       set x0 to the right of sprite 4 - the left of sprite 4
  10.       set y0 to the bottom of sprite 6 - the top of sprite 6
  11.       set r0 to sqrt((x0 * x0) + (y0 * y0))
  12.       put integer(180.0 / PI * float(atan(float(y0) / float(x0)))) into field "Ang1"
  13.       put r0 into field "R1"
  14.       put x0 into field "X1"
  15.       put y0 into field "Y1"
  16.       set the floatPrecision to 2
  17.       put float(float(y0) / float(r0)) into field "Sine"
  18.       put float(float(x0) / float(r0)) into field "Cosine"
  19.       put float(float(y0) / float(x0)) into field "Tangent"
  20.       set the locV of sprite 15 to the locV of sprite 8 - 3
  21.       set the locH of sprite 13 to the left of sprite 4 + (x0 / 2) - 30
  22.       set the locV of sprite 13 to the top of sprite 4 - (y0 / 2) - 30
  23.       updateStage()
  24.     end if
  25.   end repeat
  26.   set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
  27. end
  28.  
  29. on beginSprite me
  30.   set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
  31.   set the floatPrecision to 5
  32.   set x0 to the right of sprite 4 - the left of sprite 4
  33.   set y0 to the bottom of sprite 6 - the top of sprite 6
  34.   set r0 to sqrt((x0 * x0) + (y0 * y0))
  35.   put integer(180.0 / PI * float(atan(float(y0) / float(x0)))) into field "Ang1"
  36.   put r0 into field "R1"
  37.   put x0 into field "X1"
  38.   put y0 into field "Y1"
  39.   set the floatPrecision to 2
  40.   put float(float(y0) / float(r0)) into field "Sine"
  41.   put float(float(x0) / float(r0)) into field "Cosine"
  42.   put float(float(y0) / float(x0)) into field "Tangent"
  43.   set the floatPrecision to 5
  44.   set the locV of sprite 15 to the locV of sprite 8 - 3
  45.   set the locV of sprite 13 to the top of sprite 4 - (y0 / 2) - 30
  46. end
  47.  
  48. on endSprite me
  49.   set the cursor of sprite the spriteNum of me to 0
  50. end
  51.